//
//  SYTimeManager.h
//  Lefant
//
//  Created by sy on 2021/11/18.
//

#import <Foundation/Foundation.h>

@interface SYTimeManager : NSObject

/**
 * 获取 本地时区[ 年、月、日、周 ] 数组
 */
+ (NSArray *)timeOFDate:(NSDate *)date;
/**
 * 获取 [ 年、月、日、时、分、秒 ] 数组
 */
+ (NSArray *)timeOFDateAllTime:(NSDate *)date;

/**
 *  获取 [ 本年初、末 ] 数组
 */
+ (NSArray *)timeOFStartAndEndForYear:(NSDate *)date;

/**
 *  获取 [ 本月初、末 ] 数组
 */
+ (NSArray *)timeOFStartAndEndForMonth:(NSDate *)date;
/**
 *  获取 [ 本周初、末 ] 数组
 */
+ (NSArray *)timeOFStartAndEndForWeek:(NSDate *)date;

/**
 *  获取 [ 本日初、末 ] 数组
 */
+ (NSArray *)timeOFStartAndEndForDay:(NSDate *)date;

/**
 *  获取 [ N天前、今天 ] 数组
 */
+ (NSArray *)timeOFOtherDayToToday:(NSInteger)count;
/**
 *  获取 [ 今天、N天后 ] 数组
 */
+ (NSArray *)timeOFTodayToOtherDay:(NSInteger)count;

/**
 *  获取 [ 初始、结束(时间戳) ] 数组
 */
+ (NSArray *)timeStampOFStartAndEnd:(NSArray *)timeArray;

/// 获取当前时间 往前 往后 几天 几月 几年的时间
/// @param date 当前时间，若无 则为当前时间
/// @param dayCount 往前 往后的天数
/// @param monthCount 往前 往后的月
/// @param yearCount 往前 往后的年
+ (NSDate *)priousorLaterDateFromDate:(NSDate *)date withDay:(NSInteger)dayCount withMonth:(NSInteger)monthCount andYear:(NSInteger)yearCount;

/// 比较两个时间
/// @param expireDate 终止时间
/// @param date 比较的目标时间若无则为当前时间
+ (NSComparisonResult)sameWithExpireTime:(NSDate *)expireDate InTargetTime:(NSDate *)date;

/// 将时间转成对应的时间字符串
/// @param dateFormatStr 时间编码格式
/// @param date 时间字符串
+ (NSString *)currentTimeStr:(NSString *)dateFormatStr WithDate:(NSDate *)date;
+ (NSDate *)currentDate:(NSString *)dateFormatStr WithDateStr:(NSString *)dateStr;

+ (NSInteger)componentsCalendarUnit:(NSCalendarUnit)unit withStartDate:(NSString *)startTime endDate:(NSString *)entTime;

/**
 anyDate 转成 本地时区的 NSDate
 */
+ (NSDate *)getLocalDateFormatAnyDate:(NSDate *)anyDate;
/**
  时间转成 本地时区的 NSDate,兼容夏令时
 */
+ (NSString *)getLocalDateFormatAnyDateStr:(NSString *)anyDateStr withFormate:(NSString *)formateStr;

/**
 将本地日期字符串转为UTC日期字符串
 eg: 2017-10-25 02:07:39 -> 2017-10-24 18:07:39
 */
+ (NSString *)getUTCStrFormateLocalStr:(NSString *)localStr;
+ (NSString *)getUTCStrHHmmLocalStr:(NSString *)localStr withFormate:(NSString *)formateStr;

/**
 将UTC日期字符串转为本地时间字符串
 eg: 2017-10-25 02:07:39  -> 2017-10-25 10:07:39
 */
+ (NSString *)getLocalDateFormate:(NSString *)dateFormatStr withUTCDate:(NSString *)utcStr;
+ (NSString *)getLocalDateHHMMFormateinUTCDate:(NSString *)utcStr;

+ (BOOL)savedTimeCompareNowIsSameDay:(NSDate *)end_Time;
+ (BOOL)TimeCompareIsSameDay:(NSDate *)timeOne andTimeTwo:(NSDate *)timeTwo;

@end
